﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="listuser.ascx.cs" Inherits="controls_admin_listuser" %>
<div id="content">        
    <!-- new box --> 
    	<div class="box corners shadow">
            <div class="box-header">
                <img src="../images/admin/contact.png" /><h2>Thành viên</h2>
                <div class="box-header-ctrls">	
                	<a href="javascript:void(null);" title="" class="close"><!-- --></a>
                </div>
            </div>                
            <div class="box-content" id="contacts-1a">
               <div class="inbox-sf">
                    <asp:TextBox ID="txtTuKhoa" runat="server" onFocus="if(this.value=='Tìm kiếm thành viên')this.value='';" onBlur="if(this.value=='')this.value='Tìm kiếm thành viên';" value="Tìm kiếm thành viên" class="input-1"></asp:TextBox>                    
                    <asp:DropDownList ID="ddlQuyenTruyCap" runat="server" class="select-1">
                    </asp:DropDownList>
                    <asp:Button ID="btnTim" runat="server" class="inbox-sf-search-btn" Text="Tìm" 
                        onclick="btnTim_Click" />
                    <div class="form-msg-good-advanced" runat="server" id="msgSuccess" style="display:none; float:left; margin-left:20px; margin-bottom:20px; width:220px;"></div>
                    <asp:Button ID="btnThem" runat="server" Text="Thêm" 
                        class="inbox-sf-add-btn tip" title="Thêm một thành viên mới" 
                        onclick="btnThem_Click" />                                                            
                </div>                                                           
                <table id="tablesorter-contact" style="width:100%">
                    <asp:Repeater ID="rptDanhSachThanhVien" runat="server" 
                        onitemcommand="rptDanhSachThanhVien_ItemCommand"> 
                        <HeaderTemplate>
                	        <thead class="contacts-head-1"> 
                                <tr> 
                                    <th class="contacts-head-1-select" style="width:2%"><asp:CheckBox ID="CheckSelectAll" runat="server"/></th>
                                    <th class="contacts-head-1-id header" style="width:4%">STT</th>
                                    <th class="contacts-head-1-name header" style="width:12%">Tên đăng nhập</th>
                                    <th class="contacts-head-1-name header" style="width:15%">Tên đầy đủ</th>
                                    <th class="contacts-head-1-role header" style="width:9%">Quyền truy cập</th>
                                    <th class="contacts-head-1-email header" style="width:20%">Email</th>
                                    <th class="contacts-head-1-date header" style="width:10%">Ngày tham gia</th>
                                    <th class="contacts-head-1-date header" style="width:10%">Trạng thái</th>
                                    <th class="contacts-head-1-actions" style="width:7%">Thao tác</th>                        
                                </tr> 
                            </thead>
                           <tbody class="contacts-content-1">
                        </HeaderTemplate> 
                        <ItemTemplate>                                                                                
                                <tr> 
                                    <td class="contacts-content-1-select" style="width:2%">
                                        <asp:Literal ID="ltTenDangNhap" Text='<%# Eval("TenDangNhap") %>' Visible="false" runat="server"></asp:Literal>
                                        <asp:CheckBox ID="CheckSelect" runat="server"/>
                                    </td>
                                    <td class="contacts-content-1-id" style="width:4%"><%= stt++%></td>
                                    <td class="contacts-content-1-name" style="width:12%"><%# Eval("TenDangNhap")%></td>
                                    <td class="contacts-content-1-name" style="width:15%"><%# Eval("TenDayDu")%></td>
                                    <td class="contacts-content-1-role" style="width:9%"><%# Eval("TenQuyen")%></td>
                                    <td class="contacts-content-1-email" style="width:20%"><%# Eval("Email")%></td>
                                    <td class="contacts-content-1-date" style="width:10%"><%# Eval("NgayThamGia","{0:dd/mm/yyyy}")%></td>
                                    <td class="contacts-content-1-date" style="width:10%"><%# (Boolean.Parse(Eval("TrangThai").ToString())==true)?"Hoạt động":"Không hoạt động"%></td>
                                    <td class="contacts-content-1-actions" style="width:7%">
                                        <asp:HyperLink ID="hlSua" runat="server" class="edit-contact gradient-btn" NavigateUrl='<%# "~/admin/adduser.aspx?action=edit&info=" + Eval("TenDangNhap") %>'>Sửa</asp:HyperLink>
                                        <asp:LinkButton ID="lbXoa" runat="server" onclientclick="return confirm('Chắc chắn rằng bạn muốn xóa thành viên này?');" class="delete-contact gradient-btn" CommandArgument='<%# Eval("TenDangNhap")%>' CommandName="xoa">Xóa</asp:LinkButton>                                                                                
                                    </td>                        
                                </tr>                                                                                                                                                                                                                                                       
                            
                        </ItemTemplate>
                        <FooterTemplate></tbody></FooterTemplate>
                    </asp:Repeater>                                            
                </table>
                <div class="form-msg-warning-advanced" runat="server" id="msgSearch" style="display:none; float:left; margin-left:0px; margin-bottom:20px; width:220px;">Không có kết quả như yêu cầu tìm kiếm!</div>
                <div class="form-msg-warning-advanced" runat="server" id="msgNoRows" style="display:none; float:left; margin-left:0px; margin-bottom:20px; width:200px;">Dữ liệu đang cập nhật...</div>
                <div class="box-bt-bar">                                          
                    <ul class="box-nav" style="display:inline-table;" runat="server" id="PhanTrang">
                        <li>
                            <asp:LinkButton ID="lbtnFirst" runat="server" CausesValidation="false" 
                                        OnClick="lbtnFirst_Click" CssClass="prev">Đầu</asp:LinkButton>
                        </li>
                        <li>
                            <asp:LinkButton ID="lbtnPrevious" runat="server" CausesValidation="false" 
                                        OnClick="lbtnPrevious_Click" CssClass="prev">Trước</asp:LinkButton>
                        </li>
                        <li>
                            <asp:DataList ID="dlPaging" runat="server" OnItemCommand="dlPaging_ItemCommand" 
                                OnItemDataBound="dlPaging_ItemDataBound" RepeatDirection="Horizontal">
                                <ItemTemplate>                                
                                    <asp:LinkButton ID="lnkbtnPaging" runat="server" CssClass="num" 
                                        CommandArgument='<%# Eval("PageIndex") %>' CommandName="Paging" 
                                        Text='<%# Eval("PageText") %>'></asp:LinkButton>                                
                                </ItemTemplate>
                            </asp:DataList>
                        </li>                        
                        <li>
                            <asp:LinkButton ID="lbtnNext" runat="server" CausesValidation="false" 
                                        OnClick="lbtnNext_Click" CssClass="next">Tiếp</asp:LinkButton>
                        </li>
                        <li>
                            <asp:LinkButton ID="lbtnLast" runat="server" CssClass="next" CausesValidation="false" 
                                        OnClick="lbtnLast_Click">Cuối</asp:LinkButton>
                        </li>                        
                        <asp:Label ID="lblPageInfo" runat="server" Visible="false"></asp:Label>
                    </ul>
                    <%--<ul class="box-nav" runat="server" id="Ul1">
                        <li><a href="#" title="" class="prev">Trước</a></li>
                        <li><a href="#" title="" class="active">1</a></li>
                        <li><a href="#" title="" class="num">2</a></li>
                        <li><a href="#" title="" class="num">3</a></li>

                        <li><a href="#" title="" class="num">4</a></li>
                        <li><a href="#" title="" class="num">..</a></li>
                        <li><a href="#" title="" class="next">Sau</a></li>
                    </ul>--%>
                    <div class="bulk-actions">
                        <%--<select name="field-13" class="select-1">
                            <option value="">Chọn thao tác</option>
                            <option value="">Sửa</option>
                            <option value="">Xóa</option>
                        </select>--%>
                        <asp:Button ID="btnXoa" runat="server" Text="Xóa" onclick="btnXoa_Click" />
                        <asp:Button ID="btnLamMoi" runat="server" Text="Làm mới" 
                            onclick="btnLamMoi_Click" />                        
                    </div> 
                </div>                 
            </div>            
        </div>                                                                       
</div>
<script type="text/javascript" src="../scripts/admin/checkAll.js"></script>
<script type="text/javascript">
    var rptDanhSachThanhVienControl = document.getElementById('<%= rptDanhSachThanhVien.ClientID %>');
    $('input:checkbox[id$=CheckSelectAll]', rptDanhSachThanhVienControl).click(function(e)
    {
        if (this.checked)
        {
            $('input:checkbox[id$=CheckSelect]', rptDanhSachThanhVienControl).attr('checked', true);
        }
        else
        {
            $('input:checkbox[id$=CheckSelect]', rptDanhSachThanhVienControl).removeAttr('checked');
        }
    });
   
    $('input:checkbox[id$=CheckSelect]', rptDanhSachThanhVienControl).click(function(e)
    {
        //Bo checkall
        if ($('input:checkbox[id$=CheckSelect]:checked', rptDanhSachThanhVienControl).length == 0)
        {
            $('input:checkbox[id$=CheckSelectAll]', rptDanhSachThanhVienControl).removeAttr('checked');
        }
        // Checkall
        else if ($('input:checkbox[id$=CheckSelect]:checked', rptDanhSachThanhVienControl).length == $('input:checkbox[id$=CheckSelect]', rptDanhSachThanhVienControl).length)
        {
            $('input:checkbox[id$=CheckSelectAll]', rptDanhSachThanhVienControl).attr('checked', true);
        }
    });

</script>

